package com.atguigu.distributed.lock.service;

import com.atguigu.distributed.lock.pojo.Stock;
import org.springframework.stereotype.Service;

/**
 * @author BLADE
 * @description:
 * @data 2024/4/2410:34
 */
@Service
public class StockService2 {
    private Stock stock =new Stock();

    public synchronized void deduct(){
        stock.setStock(stock.getStock()-1);
        System.out.println("扣减成功，剩余库存："+stock.getStock());
    }

}
